<?php

Router::connect('', array('controller' => 'Sample')); // default route

/*
    !!! a more detailed way of declaring route
        Router::connect('/posts/:id', array('controller' => 'Posts', 'action' => 'show'), array(':id' => '([0-9]+)'));

    !!! the order of the tokens has to be the same in the url pattern and token array.
        following code won't work.
        Router::connect('/articles/:yyyy/:mm/:dd', array('controller' => 'Posts', 'action' => 'list'),
                                                   array(':mm' => '(0[1-9]|1[012])',
                                                         ':yyyy' => '([12][0-9]{3})',
                                                         ':dd' => '(0[1-9]|[12][0-9]|3[01])'));

    !!! every single token needs to have it's own declaration in the token array, even
        though they could share the same regex or even the same name.
        following code won't work.
        Router::connect('/articles/:xx/:xx', array('controller' => 'Posts', 'action' => 'list'),
                                             array(':xx' => '(0[1-9]|1[012])');

        correct way.
        Router::connect('/articles/:xx/:yy', array('controller' => 'Posts', 'action' => 'list'),
                                             array(':xx' => '(0[1-9]|1[012])',
                                                   ':yy' => '(0[1-9]|1[012])');
*/

/*
    if none resolves, it will map to /:controller/:action/:param1/:param2
    to controller->action($params)
    $params = array('controller' => $controller,
                    'action' => $action,
                    ':1' => $param1,
                    ':2' => $param2);
*/